import { Entity, model, property, hasMany, relation } from '@loopback/repository';
import { TodoList } from './todo-list.model';

@model()
export class User extends Entity {
  @property({
    type: 'number',
    id: true,
    // required: true,
  })
  id: number;

  @property({
    type: 'string',
    required: true,
  })
  name: string;

  @property({
    type: 'string',
    required: true,
  })
  username: string;

  @property({
    type: 'string',
    required: true,
  })
  email: string;

  @property({
    type: 'string',
  })
  avatar?: string;

  @property({
    type: 'string',
  })
  password?: string;

  // @hasMany(() => TodoList)
  // // @property.array(() => TodoList)
  // todoLists?: TodoList[];

  @property({
    type: 'date',
    required: true,
  })
  created: string;

  @property({
    type: 'date',
    required: true,
  })
  lastUpdated: string;

  constructor(data?: Partial<User>) {
    super(data);
  }
}
